/*
 * Copyright 2010-2013 MaMuN
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package main.java.net.bornil.db.entity.admin;

/**
 * @author MaMuN
 * @since Sep 23, 2012
 */
public final class UserAvailabilityStatus {

    private static final UserAvailabilityStatus AVAILABLE_INSTANCE = new UserAvailabilityStatus(true, new String[0]);

    private boolean available;
    private String[] suggestions;

    private UserAvailabilityStatus(boolean available, String[] suggestions) {
        this.available = available;
        this.suggestions = suggestions;
    }

    public static UserAvailabilityStatus available() {
        return AVAILABLE_INSTANCE;
    }

    public static UserAvailabilityStatus notAvailable(String userId) {
        String[] suggestions = new String[3];
        for (int i = 0; i < suggestions.length; i++) {
            suggestions[i] = userId + (i + 1);
        }
        return new UserAvailabilityStatus(false, suggestions);
    }

    public boolean isAvailable() {
        return available;
    }

    public String[] getSuggestions() {
        return suggestions;
    }
}
